package com.niit.xlztest.repository;

import com.niit.xlztest.bean.Book;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface DetailRepository extends JpaRepository<Book,Integer> {
    @Query("from Book b where b.book_id = :book_id")
    Book findBookBid(@Param("book_id") String book_id);

    @Modifying
    @Query("UPDATE Book b SET b.book_borrow = b.book_borrow + 1 WHERE b.book_id = :book_id")
    void updateBook(@Param("book_id") String book_id);




}
